﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="NhanVien.aspx.cs" Inherits="NhanVien" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <script language="javascript" type="text/javascript">
// <![CDATA[

        function File1_onclick() {

        }

// ]]>
    </script>
<style type="text/css">
    .style2
    {
        font-size: large;
    }
    .style3
    {
        text-decoration: underline;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    Thêm nhân viên:<br />
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="EmployeeID" DataSourceID="objEmployee" Height="16px" 
        Width="424px"
        DefaultMode="Insert">
        <Fields>
            <asp:TemplateField HeaderText="Last Name: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox11" Text='<%# Bind("LastName") %>' runat="server" SortExpression="LastName"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="First Name: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" Text='<%# Bind("FirstName") %>' runat="server" SortExpression="FirstName"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Department ID: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" Text='<%# Bind("DepartmentID") %>' runat="server" SortExpression="DepartmentID"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Salary: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" Text='<%# Bind("Salary") %>' runat="server" SortExpression="Salary"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hire Date: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox6" Text='<%# Bind("HireDate") %>' runat="server" SortExpression="HireDate"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="URL Peronal Photo: ">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" Text='<%# Bind("URLPersonalPhoto") %>' runat="server" SortExpression="URLPersonalPhoto"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <input id="File1" type="file" src="image/" onclick="return File1_onclick()" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Description: ">
                <InsertItemTemplate>
                    <asp:TextBox TextMode="MultiLine" Rows="5" ID="TextBox5" 
                        Text='<%# Bind("Description") %>' runat="server" SortExpression="Description" 
                        Height="43px" Width="214px"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>            
            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:ObjectDataSource ID="objEmployee" runat="server" DeleteMethod="Delete" 
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="GetData" TypeName="PagingDataTableAdapters.EmployeesTableAdapter" 
        UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_EmployeeID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="DepartmentID" Type="Int32" />
            <asp:Parameter Name="Salary" Type="Decimal" />
            <asp:Parameter Name="HireDate" Type="DateTime" />
            <asp:Parameter Name="URLPersonalPhoto" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Original_EmployeeID" Type="Int32" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <br />
    <strong><span class="style2">
<asp:Label ID="lblPhong" runat="server" CssClass="style3"></asp:Label>
:</span></strong><br />
&nbsp;<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="EmployeeID" 
        DataSourceID="MySource" PageSize="20" CellPadding="4" 
    ForeColor="#333333" GridLines="None" Height="633px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
            <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
                SortExpression="DepartmentID" />
            <asp:BoundField DataField="Salary" HeaderText="Salary" 
                SortExpression="Salary" />
            <asp:BoundField DataField="HireDate" HeaderText="HireDate" 
                SortExpression="HireDate" />
            <asp:TemplateField HeaderText="URLPersonalPhoto" 
                SortExpression="URLPersonalPhoto">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" 
                        Text='<%# Bind("URLPersonalPhoto") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" 
                        ImageUrl='<%# Eval("URLPersonalPhoto") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="MySource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
        SelectCommand="SELECT * FROM [Employees]" UpdateCommand="Update dbo.Employees Set LastName=@LastName, FirstName=@FirstName, DepartmentID=@DepartmentID,
Salary=@Salary, HireDate=@HireDate,URLPersonalPhoto=@URLPersonalPhoto,Description=@Description
Where EmployeeID = @EmployeeID"        
        >
        <UpdateParameters>
            <asp:Parameter Name="LastName" />
            <asp:Parameter Name="FirstName" />
            <asp:Parameter Name="DepartmentID" />
            <asp:Parameter Name="Salary" />
            <asp:Parameter Name="HireDate" />
            <asp:Parameter Name="URLPersonalPhoto" />
            <asp:Parameter Name="Description" />
            <asp:Parameter Name="EmployeeID" />
        </UpdateParameters>
</asp:SqlDataSource>
    <br />
    <asp:DetailsView ID="DetailsView2" runat="server" AllowPaging="True" 
    AutoGenerateRows="False" DataKeyNames="EmployeeID" DataSourceID="MySource" 
    Height="50px" Width="508px">
        <Fields>
            <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
                SortExpression="DepartmentID" />
            <asp:BoundField DataField="Salary" HeaderText="Salary" 
                SortExpression="Salary" />
            <asp:BoundField DataField="HireDate" HeaderText="HireDate" 
                SortExpression="HireDate" />
            <asp:TemplateField HeaderText="URLPersonalPhoto" 
                SortExpression="URLPersonalPhoto">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" 
                        Text='<%# Bind("URLPersonalPhoto") %>'></asp:TextBox>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" 
                        Text='<%# Bind("URLPersonalPhoto") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="Image4" runat="server" 
                        ImageUrl='<%# Eval("URLPersonalPhoto") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:CommandField ShowEditButton="True" />
        </Fields>
</asp:DetailsView>
    <br />
    <asp:DataList ID="DataList1" runat="server" BackColor="LightGoldenrodYellow" 
        BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyField="EmployeeID" 
        DataSourceID="MySource" ForeColor="Black" Width="318px">
        <AlternatingItemStyle BackColor="PaleGoldenrod" />
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <ItemTemplate>
            EmployeeID:
            <asp:Label ID="EmployeeIDLabel" runat="server" 
                Text='<%# Eval("EmployeeID") %>' />
            <br />
            LastName:
            <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
            <br />
            FirstName:
            <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
            <br />
            DepartmentID:
            <asp:Label ID="DepartmentIDLabel" runat="server" 
                Text='<%# Eval("DepartmentID") %>' />
            <br />
            Salary:
            <asp:Label ID="SalaryLabel" runat="server" Text='<%# Eval("Salary") %>' />
            <br />
            HireDate:
            <asp:Label ID="HireDateLabel" runat="server" Text='<%# Eval("HireDate") %>' />
            <br />
            URLPersonalPhoto:&nbsp;<br /><asp:Image ID="Image3" runat="server" 
                ImageUrl='<%# Eval("URLPersonalPhoto") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Eval("Description") %>' />
            <br />
            <br />
        </ItemTemplate>
        <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    </asp:DataList>
    <br />
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="MySource" 
    DataMember="DefaultView">
    </asp:Repeater>
</asp:Content>

